<?php
  $trimmed_content = $author->getTrimmedContent()
?>

<h1><?php echo $author->getName() ?></h1>
<?php if($author->getContent()): ?>
  <h3>Who is <?php echo $author->getSex()=="M" ? 'he' : 'she' ?>?</h3>

  <p class="trim">
    <?php echo nl2br($trimmed_content['value']) ?>
    <br />
    <?php if($trimmed_content['more']): ?>
      <a class="more" style="cursor: pointer">
        More ...
      </a>
    <?php endif ?>
  </p>
  <p class="full" style="display: none">
    <?php echo nl2br($author->getContent()) ?>
    <br />
    <br />
    <a target="_blank" href="<?php echo $author->getUrl() ?>">
      Read more on wikipedia
    </a>
    <br />
    <br />
    <a class="less" style="cursor: pointer">
      Less ...
    </a>
  </p>
<?php endif ?>
<br />
<p>
  <?php if ($sf_user->isAuthenticated()): ?>
    <?php if($author->isBookmark($sf_user->getAttribute('user_id', null, 'sfGuardSecurityUser'))): ?>
      <a class="remove_book bookmark_text" title="Remove from bookmarks" href="<?php echo url_for('profile/removeAuthorBookmark?author_id='.$author->getId()) ?>">
        Remove author from bookmark
      </a>
    <?php else: ?>
      <a class="add_book bookmark_text" title="Add to bookmarks" href="<?php echo url_for('profile/addAuthorBookmark?author_id='.$author->getId()) ?>">
        Add author to bookmarks
      </a>
    <?php endif ?>
  <?php endif ?>
</p>
<p>
  <?php if (count($author->getCategorys())): ?>
    Categories:
    <?php foreach ($author->getCategorys() as $category): ?>
      <?php echo link_to($category->getName(), 'author_show_by_category', $category) ?>
    <?php endforeach ?>
  <?php endif ?>
</p>
<h3>Quotes from <?php echo $author->getSex()=="M" ? 'him' : 'her' ?></h3>

<?php include_partial('quote/quotes', array('author' => $author, 'pager' => $pager)) ?>

<script type="text/javascript">
  $(document).ready(function(){
    $('.more').click(function() {
      $('.trim').slideUp(400, function(){
        $('.full').slideDown();
      });
    });

    $('.less').click(function() {
      $('.full').slideUp(400, function(){
        $('.trim').slideDown();
      });
    });
  });
</script>
